<include file="public/layout" />

<body style="background-color: #FFF; overflow: auto;">

<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>

<div id="append_parent"></div>

<div id="ajaxwaitid"></div>

<div class="page">

    <div class="fixed-bar">

        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>

            <div class="subject">

                <h3>在线客服-编辑客服</h3>

                <h5>网站系统微信信息配置模板管理</h5>

            </div>

        </div>

    </div>

    <form class="form-horizontal" id="addKefu" method="post">

        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label><em>*</em>用户名</label>
                </dt>
                <dd class="opt">
                    <select name="admin_id" id="admin_id">
                        <option  value="0">不选则无用户{$kefu['admin_id']}</option>
                        <volist name="admin" id="s">
                            <option <if condition="$kefu['admin_id'] eq $s['admin_id']">selected="selected"</if>  value="{$s.admin_id}">{$s.user_name}</option>
                        </volist>
                    </select>
                    <p class="notic">用户名</p>
                </dd>
            </dl>

            <dl class="row">

                <dt class="tit">

                    <label for="kf_name"><em>*</em>客服昵称</label>

                </dt>

                <dd class="opt">

                    <input type="text" value="{$kefu.kf_name}" name="kf_name" id="kf_name" class="input-txt">

                    <span class="err" id="err_kf_name" style="display:none;">客服昵称不能为空 </span>

                    <p class="notic">客服昵称</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label for="kf_no"><em>*</em>客服编号</label>

                </dt>

                <dd class="opt">

                    <input type="text" value="{$kefu.kf_no}" name="kf_no" id="kf_no"  class="input-txt" <if condition="$kefu[kf_no] neq ''">disabled</if>>
                    <span id="err_kf_no" class="err" style="display:none;">客服编号不能为空</span>
                    <span id="err_kf_no2" class="err" style="display:none;color:red">该客服编号已存在</span>

                    <p class="notic">客服编号添加后无法修改</p>

                </dd>

            </dl>

             <dl class="row">
                 <dt class="tit">
                     <label for="kf_headpic">客服头像</label>
                 </dt>
                 <dd class="opt">
                     <div class="input-file-show">
                         <span class="show">
                             <a id="img_a" class="nyroModal" rel="gal" href="{$kefu.kf_headpic}">
                                 <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src={$kefu.kf_headpic}>',this,{tips: [1, '#fff']})" onmouseout="layer.closeAll()"></i>
                             </a>
                         </span>
                            <span class="type-file-box">
                             <input type="text" id="kf_headpic" name="kf_headpic" value="{$kefu.kf_headpic}" class="type-file-text">
                             <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                             <input class="type-file-file" onClick="GetUploadify(1,'','link','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                         </span>
                     </div>
                     <span class="err"></span>
                     <p class="notic">如果没有上传头像,通用头像显示，最佳显示尺寸为100*100像素</p>
                 </dd>
             </dl>
            

            <div class="bot"><a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>

        </div>

      </label>
      <input type="hidden" name="id" value="{$kefu.id}">
    </form>

</div>

<script type="text/javascript">

    // 判断输入框是否为空

    function checkForm(){

        var kf_name = $("#addKefu").find("input[name='kf_name']").val();


        var kf_no = $("#addKefu").find("input[name='kf_no']").val();
        if($.trim(kf_name) == '')

        {

            $("#err_kf_name").show();

            return false;

        }   
        if($.trim(kf_no) == '')

        {

            $("#err_kf_no").show();

            return false;

        }
        
        $.post('{:U("Admin/Kefu/check_kf_no")}',{kf_no:kf_no},function(res){
            if(res>0){
                $("#err_kf_no2").show();
            }else{
                $('#addKefu').submit();
            }
        })
        

    }

    function img_call_back(fileurl_tmp)
    {
        $("#kf_headpic").val(fileurl_tmp);
        $("#img_a").attr('href', fileurl_tmp);
        $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
    }

</script>

</body>

</html>